jQuery(function($){
	$.datepicker.regional['zh-CN'] = {
		closeText: '关闭',
		prevText: '&#x3c;上月',
		nextText: '下月&#x3e;',
		currentText: '今天',
		monthNames: ['1月','2月','3月','4月','5月','6月',
		'7月','8月','9月','10月','11月','12月'],
		monthNamesShort: ['1','2','3','4','5','6',
		'7','8','9','10','11','12'],
		dayNames: ['星期日','星期一','星期二','星期三','星期四','星期五','星期六'],
		dayNamesShort: ['周日','周一','周二','周三','周四','周五','周六'],
		dayNamesMin: ['日','一','二','三','四','五','六'],
		weekHeader: '周',
		dateFormat: 'yy-mm-dd',
		firstDay: 1,
		isRTL: false,
		showMonthAfterYear: true,
		yearSuffix: '-'};
	$.datepicker.setDefaults($.datepicker.regional['zh-CN']);
});

function closePdfView(){
	$(".slide").hide();
}
function showPdfView(){ 
	$(".slide").show();
	var fp = new FlexPaperViewer(	
			'http://localhost/promise/flash/FlexPaperViewer',
			'viewerPlaceHolder', { config : {
			SwfFile : 'http://localhost/promise/flash/Paper.swf',
			Scale : 0.5, 
			ZoomTransition : 'easeOut',
			ZoomTime : 0.5,
			ZoomInterval : 0.2,
			FitPageOnLoad : false,
			FitWidthOnLoad : true,
			PrintEnabled : false,
			FullScreenAsMaxWindow : false,
			ProgressiveLoading : false,
			MinZoomSize : 0.2,
			MaxZoomSize : 5,
			SearchMatchAll : false, 
			
			ViewModeToolsVisible : true,
			ZoomToolsVisible : true,
			NavToolsVisible : true,
			
			SearchToolsVisible : true,
				
				 localeChain: 'en_US'
			}});
}
$(function(){   
	$("#report-date").datepicker();
	$(".breadcumb-report-search .date").datepicker();
	
	
	$(".breadcumb-report-search .org").click(function(event){ 
		$(document).one('click', function(event) {
			$(".inst-menu").hide();
		});
		
		$(".inst-menu").css({"left":"0","top":"0"}).position({
			my: "left top",
			at: "left bottom",
			of: this, 
		}).show();

		event.stopPropagation();
	});

	
	$(".inst-menu").click(function(event){ 
		event.stopPropagation();
	});
	
	$.each($(".inst-menu .tabs").children(),function(){
		$(this).click(function(){
			var index = $(this).attr("id");
			$(".inst-menu .tabs li.active").removeClass("active");
			$(this).addClass("active");
			$(".inst-menu .tab-body").addClass("hidden");
			$(".inst-menu .tab-body[id="+index+"]").removeClass("hidden");
		});
	}); 
	
	$(document).keydown(function(e){
		if(e.keyCode==27){ 
			closePdfView();
		}
	}); 
});
 